package mshop.com.schild_kotlin.network;

import com.orhanobut.logger.Logger;

import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;

/**
 * Created by mayi on 2018/5/30.
 *
 * @Autor CaiWF
 * @Email 401885064@qq.com
 * @TODO
 */
public class Http302Util2 {
    private static OkHttpClient okHttpClient = new OkHttpClient.Builder()
            .followRedirects(false)
            .build();

    /**
     * get请求，不带参数
     *
     * @param url      请求地址
     * @param callback 回调监听
     */
    public static void get(String url, Callback callback) {
        Logger.e("get请求 url :" + url);
        Request request = new Request.Builder().url(url).get().build();
        Logger.d("followRedirects :" + okHttpClient.followRedirects());
        okHttpClient.newCall(request).enqueue(callback);
    }

}
